<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="/include/head.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>基础数据维护</title>
<script type="text/javascript">

$(document).ready(function(){
	hideAll = function(){
		$("#edit", navTab.getCurrentPanel()).hide();
		$("#add", navTab.getCurrentPanel()).hide();
		$("#del", navTab.getCurrentPanel()).hide();
	};
	
	treeClick = function(type, parentId, id, editAble){
		editAble = editAble=='${USER.coid}';
		hideAll();
		var param = {'map.level_I':'','map.prodDesc_L':'${pager.scMap.prodName_L}'};
		if(type=="root"){
			//$("#add", navTab.getCurrentPanel()).show();
			//$("#add", navTab.getCurrentPanel()).attr("href","product/toEditProductType/-99999999.do?bigType=" + id + "&funId=${funId}");
			//$("#add_title", navTab.getCurrentPanel()).html("添加小类");
		}else if(type=="dataType"){
			//$("#edit", navTab.getCurrentPanel()).show();
			//$("#edit", navTab.getCurrentPanel()).attr("href","product/toEditProductType/" + id + ".do?funId=${funId}");
			//$("#edit_title", navTab.getCurrentPanel()).html("编辑小类");
			
			$("#add", navTab.getCurrentPanel()).show();
			$("#add", navTab.getCurrentPanel()).attr("href","company/toEditDict/-99999999.do?myType=" + id + "&funId=${funId}");
			$("#add_title", navTab.getCurrentPanel()).html("添加数据项");
			param['map.bigKey'] = id;
			
		}else if(type=="data" && editAble){
			$("#edit", navTab.getCurrentPanel()).show();	
			$("#edit", navTab.getCurrentPanel()).attr("href","company/toEditDict/" + id + ".do?funId=${funId}");
			$("#edit_title", navTab.getCurrentPanel()).html("编辑数据项");
			
			$("#del", navTab.getCurrentPanel()).show();	
			$("#del", navTab.getCurrentPanel()).attr("href","company/delDict/" + id + ".do?funId=${funId}");
			$("#del_title", navTab.getCurrentPanel()).html("停用数据项");
		}
		//点击不是产品时，加载右边的列表
		if(type!="data"){
			$("#productList", navTab.getCurrentPanel()).loadUrl("company/dictPager/dictList.do",param);
		}
	}
	hideAll();
});
</script>
</head>
<body>
	<div class="panelBar">
		<ul class="toolBar">
			<li><a id="add" class="add" href="product/toEdit/-99999999.do?funId=${funId}" target="navTab" rel="productEdit"><span id="add_title">添加</span></a></li>
			<li><a id="edit" class="edit" href="product/toEdit/-99999999.do?funId=${funId}" target="navTab" rel="productEdit"><span id="edit_title">编辑</span></a></li>
			<li><a id="del" class="del" href="product/delete/-99999999.do?funId=${funId}" target="ajaxTodo"><span id="del_title">停用产品</span></a></li>
			
		</ul>
	</div>
	
	<div id="productTree" style=" float:left; margin:2px; width:26%;overflow:auto; border:solid 1px #CCC;">
	
		<div class="panelBar">
			<ul class="toolBar">
			
			<form rel="listView_"  target="navTab"  onsubmit="return navTabSearch(this);" action="product/productTree.do?funId=${funId}" method="post">
				<li>名称<input type="text" name="map.prodName_L" id="prodName_L" value="${pager.scMap.prodName_L}"/></li>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">查询</button></div></div></li>
			</form>
			</ul>
		</div>
			
		<div layoutH="28" id="w_list_print">
			<ul class="tree treeFolder expand" oncheck="treeCheck">
				<li><a  onclick="treeClick('root','','',false);">基础数据</a>
					<ul>
				    <c:forEach items="${dictTree}" var="dataType">			
				        <li><a  onclick="treeClick('dataType','root','${dataType.key}',false);">${dataType.value }</a>
							<ul>
						    <c:forEach items="${dataType.list}" var="data">
						        <li><a tname="smallType" tvalue="${data.id }" onclick="treeClick('data','${dataType.id }','${data.id }','${data.coid}');">${data.myValue}</a>
								</li>
						    </c:forEach>
							</ul>
						</li>
				    </c:forEach>
					</ul>
				</li>
			</ul>
		</div>
	</div>
	
	<div id="productList" layoutH="32"  style="float:left; margin:2px; overflow:auto; width:72%; border:solid 1px #CCC;">
	
	</div>

</body>
</html>